package com.huawei.appmarket.service.store.orderappbigimage;

import android.content.Context;
import android.text.format.DateUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appmarket.service.store.orderappbigimage.OrderAppBigImgCardBean.OrderAppBenefit;
import com.huawei.appmarket.support.video.VideoPlayer;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.List;
import o.azb;
import o.cgz;
import o.chc;
import o.chy;
import o.dof;
import o.ContentManager;
import o.eqx;
import o.evp.b;
import o.evt;
import o.evx;
import o.ewm.d;
import o.ewm.j;

public class OrderAppBigImgCard extends BaseDistCard {
    private TextView ʻ;
    private RelativeLayout ʼ;
    private ImageView ʽ;
    private VideoPlayer ˋ;
    private TextView[] ˋॱ = new TextView[2];
    private RelativeLayout ॱॱ;
    private ImageView[] ᐝ = new ImageView[2];

    public OrderAppBigImgCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (VideoPlayer) view.findViewById(j.ˊˋ);
        ˏ((ImageView) view.findViewById(j.ʽꜝ));
        ॱ((TextView) view.findViewById(j.ˊʻ));
        ˊ((TextView) view.findViewById(j.ˋ));
        this.ʽ = (ImageView) view.findViewById(j.ᐣॱ);
        ˋ((DownloadButton) view.findViewById(j.ᵣ));
        this.ʼ = (RelativeLayout) view.findViewById(j.ᐝʼ);
        this.ʻ = (TextView) view.findViewById(j.ㆍʼ);
        this.ॱॱ = (RelativeLayout) view.findViewById(j.ˊꞋ);
        this.ᐝ[0] = (ImageView) view.findViewById(j.ˋʴ);
        this.ᐝ[1] = (ImageView) view.findViewById(j.ˊₗ);
        this.ˋॱ[0] = (TextView) view.findViewById(j.ˋۥ);
        this.ˋॱ[1] = (TextView) view.findViewById(j.ˋˇ);
        ʽ(view);
        ˊ();
        return this;
    }

    public void ॱ(BaseDistCardBean baseDistCardBean) {
        if (this.ˊ != null) {
            this.ˊ.setVisibility(0);
            this.ˊ.setParam(baseDistCardBean);
            ॱ(this.ˊ.ॱ());
        }
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof OrderAppBigImgCardBean) {
            OrderAppBigImgCardBean orderAppBigImgCardBean = (OrderAppBigImgCardBean) cardBean;
            String ʽˋ = orderAppBigImgCardBean.ʽˋ();
            String ॱꞌ = orderAppBigImgCardBean.ॱꞌ();
            if (dof.ॱ(ʽˋ) && dof.ॱ(ॱꞌ)) {
                this.ˋ.setVisibility(8);
                this.ʼ.setVisibility(8);
                return;
            }
            int i = j.ʿˈ;
            int i2 = j.ʿʿ;
            String str = (String) this.ʼ.getTag(i);
            String str2 = (String) this.ʼ.getTag(i2);
            if (!dof.ˋ(str) && str.equals(ॱꞌ)) {
                return;
            }
            if (dof.ˋ(str2) || !str2.equals(ʽˋ)) {
                this.ʼ.setTag(i, ॱꞌ);
                this.ʼ.setTag(i2, ʽˋ);
                if (this.ˋ != null) {
                    this.ˋ.setVideoBaseInfo(new b().ˎ(orderAppBigImgCardBean.ᐧॱ()).ˊ(ʽˋ).ˋ(ॱꞌ).ˏ(orderAppBigImgCardBean.ͺˏ()).ʼ(orderAppBigImgCardBean.ॱﾟ()).ॱ(orderAppBigImgCardBean.u_()).ᐝ(orderAppBigImgCardBean.ᐝʽ()).ʻ(evt.ˏ(orderAppBigImgCardBean.sp_)).ॱॱ(orderAppBigImgCardBean.ॱﾞ()).ॱ());
                    Context ˋ = ContentManager.getInstant().getContext();
                    eqx.ˋ(ˋ.getResources().getDimensionPixelSize(d.ॱʽ), ˋ.getResources().getDimensionPixelSize(d.ॱʼ), this.ˋ.ॱॱ(), ʽˋ);
                }
                ˋ(this.ʻ, orderAppBigImgCardBean.ˋʻ());
                ˏ(orderAppBigImgCardBean);
                if (((OrderAppBigImgCardBean) cardBean).ʽ() != 0) {
                    ˋˊ().setText(DateUtils.formatDateTime(this.ʼॱ, ((OrderAppBigImgCardBean) cardBean).ʽ(), 16) + HwAccountConstants.BLANK + ((OrderAppBigImgCardBean) cardBean).ˊʻ());
                }
            }
        }
    }

    private void ˏ(OrderAppBigImgCardBean orderAppBigImgCardBean) {
        if (orderAppBigImgCardBean.ॱꜟ() != null && orderAppBigImgCardBean.ॱꜟ().size() > 0) {
            this.ॱॱ.setVisibility(0);
            List ॱꜟ = orderAppBigImgCardBean.ॱꜟ();
            int i = 0;
            int i2 = 0;
            while (i < ॱꜟ.size() && i < 2) {
                OrderAppBenefit orderAppBenefit = (OrderAppBenefit) ॱꜟ.get(i);
                if (dof.ॱ(orderAppBenefit.ˋ()) || dof.ॱ(orderAppBenefit.ˏ())) {
                    this.ˋॱ[i].setVisibility(8);
                    this.ᐝ[i].setVisibility(8);
                    i2++;
                } else {
                    this.ˋॱ[i].setVisibility(0);
                    this.ᐝ[i].setVisibility(0);
                    this.ˋॱ[i].setText(orderAppBenefit.ˋ());
                    eqx.ˎ(this.ᐝ[i], orderAppBenefit.ˏ());
                }
                i++;
            }
            if (i2 == 2) {
                this.ॱॱ.setVisibility(8);
            }
        }
    }

    private void ˊ() {
        int ॱ = ((azb.ॱ(this.ʼॱ) - (this.ʼॱ.getResources().getDimensionPixelSize(d.ᐝˊ) * 2)) - (this.ʼॱ.getResources().getDimensionPixelSize(d.ᐨ) * (ˎ() - 1))) / ˎ();
        this.ˋ.setLayoutParams(new LayoutParams(ॱ, (ॱ * 9) / 16));
    }

    public void ॱ(final chy o_chy) {
        OnClickListener anonymousClass5 = new evx(this) {
            final /* synthetic */ OrderAppBigImgCard ˏ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ˏ);
            }
        };
        this.ˋ.ॱॱ().setOnClickListener(anonymousClass5);
        ˉ().setOnClickListener(anonymousClass5);
        ʼॱ().setOnClickListener(anonymousClass5);
    }

    public void x_() {
        if ((this.ˊᐝ instanceof OrderAppBigImgCardBean) && this.ˉ != null) {
            OrderAppBigImgCardBean orderAppBigImgCardBean = (OrderAppBigImgCardBean) this.ˊᐝ;
            if (orderAppBigImgCardBean.ٴ() != 0) {
                this.ʽ.setVisibility(0);
                eqx.ˎ(this.ʽ, orderAppBigImgCardBean.ՙ());
                this.ˉ.setText(orderAppBigImgCardBean.ߴ());
                return;
            }
            this.ʽ.setVisibility(8);
            if (orderAppBigImgCardBean.ˊʻ() != null) {
                this.ˉ.setText(orderAppBigImgCardBean.ˊʻ());
            }
        }
    }

    public void w_() {
        eqx.ˏ(this.ʽॱ, this.ˊᐝ.ॱˌ(), "app_default_icon");
    }

    private int ˎ() {
        return chc.ͺ();
    }
}
